#ifndef WIND_CONSOLEGUI_H__
#define WIND_CONSOLEGUI_H__

#include <ncurses.h>

typedef struct console_gui_s console_gui_t;
typedef struct console_gui_menu_s console_gui_menu_t;
typedef struct console_gui_menu_element_s console_gui_menu_element_t;
typedef union console_gui_menu_element_item_u console_gui_menu_element_item_t;

typedef enum console_gui_element_type_e
{
	// MENU
	CGUI_ELEMENT_TYPE_MENU = 0,
	// ELEMENT
	CGUI_ELEMENT_TYPE_ONOFF,
	CGUI_ELEMENT_TYPE_NUMBER,
	CGUI_ELEMENT_TYPE_CHARACTER,
	CGUI_ELEMENT_TYPE_EXIT_WITH_SAVE,
	CGUI_ELEMENT_TYPE_EXIT_WITHOUT_SAVE,
	CGUI_ELEMENT_TYPE_MAX
}console_gui_element_type_t;

typedef enum console_gui_element_event_type_e
{
	CGUI_ELEMENT_EVENT_TYPE_BEGIN = 0, 
	CGUI_ELEMENT_EVENT_TYPE_END, 
}console_gui_element_event_type_t;

union console_gui_menu_element_item_u
{
	console_gui_menu_t *menu;
	char *query;
};

struct console_gui_menu_element_s
{
	int type;
	char *subject;
	console_gui_menu_element_item_t item;
	void *ex_param;
	int (*callback_procedure) (console_gui_event_t *event, void *ex_param1, void *ex_param2, void *parameter);
	console_gui_menu_element_t *prev;
	console_gui_menu_element_t *next;
};

struct console_gui_menu_s
{
	console_gui_menu_element_t *element;
};

typedef struct console_gui_event_s console_gui_event_t;
struct console_gui_event_s 
{
	int event_id;
	int event_type;
	console_gui_menu_element_t *element;
	console_gui_menu_element_item
};

struct console_gui_s 
{
	console_gui_menu_t *menu;
	void *ex_param;
	char *buff;
	int buff_size;
	int (*callback_procedure) (console_gui_event_t *event, void *ex_param1, void *ex_param2, void *parameter);
};

#endif
